package cn.ittaoli.ajax.service.impl;

import cn.ittaoli.ajax.dao.AdminMapper;
import cn.ittaoli.ajax.model.Admin;
import cn.ittaoli.ajax.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by lub_lenovo on 2017/8/2.
 */
@Service("AdminService")
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper adminMapper;
    public Admin login(Admin admin) {
        return adminMapper.selectByName(admin);
    }

    public List<Admin> getAllAdmin() {
        return adminMapper.selectAll();
    }

    public int insertAdmin(Admin admin) {
        System.out.println(System.currentTimeMillis());
        long timestamp = System.currentTimeMillis();
        admin.setInserttime(timestamp);
        return adminMapper.insertSelective(admin);
    }
}
